
import { IExtensionSingleActivationService } from "../activation/types";
import { IServiceManager } from "../ioc/types";
import { EnvironmentActivationService } from "./activation/service";
import { IEnvironmentActivationService } from "./activation/types";
import { InterpreterAutoSelectionService } from "./autoSelection";
import { InterpreterAutoSelectionProxyService } from "./autoSelection/proxy";
import { IInterpreterAutoSelectionProxyService, IInterpreterAutoSelectionService } from "./autoSelection/types";
import { EnvironmentTypeComparer } from "./configuration/environmentTypeComparer";
import { IInterpreterComparer } from "./configuration/types";
import { IInterpreterDisplay, IInterpreterHelper, IInterpreterService } from "./contracts";
import { InterpreterDisplay } from "./display";
import { InterpreterHelper } from "./helpers";
import { InterpreterService } from "./interpreterService";

function registerInterpreterTypes(serviceManager: IServiceManager): void {

    serviceManager.addSingleton<IInterpreterService>(IInterpreterService, InterpreterService);
    serviceManager.addSingleton<IInterpreterHelper>(IInterpreterHelper, InterpreterHelper);
    serviceManager.addSingleton<IInterpreterComparer>(IInterpreterComparer, EnvironmentTypeComparer);
    serviceManager.addSingleton<IInterpreterAutoSelectionService>(
        IInterpreterAutoSelectionService,
        InterpreterAutoSelectionService,
    );
    serviceManager.addSingleton<IInterpreterDisplay>(IInterpreterDisplay, InterpreterDisplay);
    serviceManager.addBinding(IInterpreterDisplay, IExtensionSingleActivationService);
}

export function registerTypes(serviceManager: IServiceManager): void {
    registerInterpreterTypes(serviceManager);
    serviceManager.addSingleton<IInterpreterAutoSelectionProxyService>(
        IInterpreterAutoSelectionProxyService,
        InterpreterAutoSelectionProxyService,
    );
    serviceManager.addSingleton<IEnvironmentActivationService>(
        EnvironmentActivationService,
        EnvironmentActivationService,
    );
    serviceManager.addSingleton<IEnvironmentActivationService>(
        IEnvironmentActivationService,
        EnvironmentActivationService,
    );
}